package com.caigou.controller;

import com.caigou.bean.cms.entity.BanWords;
import com.caigou.bean.cms.param.BanWordsParam;
import com.caigou.bean.exam.entity.Users;
import com.caigou.enums.ResponseEnum;
import com.caigou.exception.UserNotFoundException;
import com.caigou.security.utils.CurrentUser;
import com.caigou.service.IBanWordsService;
import com.caigou.util.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.ws.rs.POST;
import java.util.List;

@RestController
@RequestMapping("/ban")
public class BanWordsController {
    @Resource
    private IBanWordsService banWordsService;


    @PostMapping("/words/query")
    @PreAuthorize("hasAnyAuthority('chakanminganci')")
    public Result<PageInfo<BanWords>> queryBanWords(@RequestBody BanWordsParam param) {
        return banWordsService.queryBanWords(param);
    }

    @PostMapping("/words/add")
    @PreAuthorize("hasAnyAuthority('guanliminganci')")
    public Result<Integer> addBanWords(@RequestBody BanWordsParam param) {
        return banWordsService.addBanWords(param);
    }

    @PostMapping("/words/update")
    @PreAuthorize("hasAnyAuthority('guanliminganci')")
    public Result<Integer> updateBanWords(@RequestBody BanWordsParam param) {
        return banWordsService.updateBanWords(param);
    }

    @PostMapping("/words/delete")
    @PreAuthorize("hasAnyAuthority('guanliminganci')")
    public Result<Integer> deleteBanWords(@RequestBody BanWordsParam param) {
        return banWordsService.deleteBanWords(param);
    }





}
